package com.xuecheng.content.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * redisson配置类
 */
@Configuration
public class RedissonConfig {
    @Bean   //创建redisson工厂对象
    public RedissonClient redissonClient(){
        //配置redisson
        Config config = new Config();
        //useSingleServer表示当前redis是单机，使用单节点模式。如果redis没有密码就不设置
        config.useSingleServer().setAddress("redis://localhost:6379");
        return Redisson.create(config);
    }
}
